<script>
	
	import PDAScan from '@/util/PDAScan.js'
	// pda 极光扫描
	let PDAScanInstance
	
	export default {
		onLaunch: function() {
			this.initApp()
		},
		onShow: function() {
			console.log("App Show")
			// PDAScanInstance.startScan()
		},
		onHide: function() {
			console.log("App Hide")
			// PDAScanInstance.stopScan()
		},
		methods: {
			// 初始化应用
			initApp() {
				// scan
				// this.pdaScan()
			},
			pdaScan() {
				console.log("App Launch")
				PDAScanInstance = new PDAScan({
					broadcast: "android.intent.ACTION_DECODE_DATA",
					broadcastExtraString: "barcode_string",
					onReceive: function(code) {
/* 						console.log("onReceive 触发PDA扫码全局事件"+code)
 */						// 全局事件
						uni.$emit("pdaReceiveScancode", {
							code: code,
						})
					},
				})
			},
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
	@import "common/custom.scss"
</style>
